Skip to content

Conversation

@purplecabbage
Copy link
Member

@purplecabbage purplecabbage commented May 15, 2025

Description

Inject env var to detect if we were run by aio app dev
this can be read as truthy, it will not exist in Runtime (ie. aio app run )

console.log('AIO_DEV ', process.env.AIO_DEV ? 'dev' : 'prod')

Related Issue

adobe/aio-cli#753

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@purplecabbage purplecabbage requested a review from Copilot May 15, 2025 19:34
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces an environment variable flag to detect when the application is running in a local development (dev) mode as opposed to in production.

  • Adds the AIO_DEV environment variable in run-dev.js to indicate a development environment.
  • Includes comments to clarify that this flag is only set during local development runs.

@codecov
Copy link

codecov bot commented May 15, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (3b5bf4d) to head (c1e1699).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #151   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            7         7           
  Lines          641       642    +1     
  Branches       132       132           
=========================================
+ Hits           641       642    +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@purplecabbage purplecabbage requested a review from Copilot May 20, 2025 00:31
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request adds an environment flag (AIO_DEV) to detect when the application is running in development mode via "aio app dev".

  • Introduces new environment variable AIO_DEV with a truthy value
  • Adds inline comments explaining the purpose of the flag

@purplecabbage purplecabbage requested a review from Copilot May 20, 2025 00:36
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a new environment flag, AIO_DEV, to distinguish between local development and runtime environments.

  • The change injects the AIO_DEV environment variable with a truthy string value ("true") when running locally with aio app dev.
  • The change is implemented in the src/lib/run-dev.js file to enable environment detection during development.

// set up environment variables for aio
// this can be read as truthy, it will not exist in Runtime
// ex. console.log('AIO_DEV ', process.env.AIO_DEV ? 'dev' : 'prod')
process.env.AIO_DEV = 'true'
Copy link

Copilot AI May 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider checking if process.env.AIO_DEV is already set before overwriting it. This helps preserve any external overrides and makes the intent of the flag clearer.

Suggested change
process.env.AIO_DEV = 'true'
if (process.env.AIO_DEV === undefined) {
process.env.AIO_DEV = 'true'
}

Copilot uses AI. Check for mistakes.
@purplecabbage purplecabbage merged commit 2b63ead into main May 20, 2025
10 checks passed
@purplecabbage purplecabbage deleted the ACNA-3825 branch May 20, 2025 00:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants